package view;

import java.awt.Color;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.util.Observable;
import java.util.Observer;

import javax.swing.JLabel;

import model.CurrentSlot;

import xl.Address;

public class SlotView extends JLabel {
	private Address myAddress;
	private CurrentSlot currentSlot;
	private SlotView myself = this;
	
    public SlotView(Address myAddress, CurrentSlot currentSlot) {
        super("                    ", LEFT);
        setBackground(Color.WHITE);
        setOpaque(true);
        addMouseListener(new ClickListener());
        this.myAddress = myAddress;
        this.currentSlot = currentSlot;
    }
    
	private class ClickListener extends MouseAdapter {
		public void mousePressed(MouseEvent event) {
			currentSlot.updateCurrent(myself);
		}
	}
	
	public Address getAddress() {
		return myAddress;
	}
}